﻿/*
Copyright © 2010 François Karman

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

See <license.txt> for the complete license of the software.
*/

using System;
using System.Runtime.Serialization;

namespace MSBuild.Mercurial
{
    /// <summary>
    /// A critical error occurs during the execution of the command.
    /// </summary>
    [Serializable]
    public class HgProcessException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the HgProcessException class.
        /// </summary>
        [Obsolete("Always use a constructor with a message")]
        public HgProcessException()
            : base()
        {
        }

        /// <summary>
        /// Initializes a new instance of the HgProcessException class
        /// with an error message.
        /// </summary>
        /// <param name="message">
        /// The message that describes the error.
        /// </param>
        public HgProcessException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Initializes a new instance of the HgProcessException class
        /// with an error message and an inner exception.
        /// </summary>
        /// <param name="message">
        /// The message that describes the error.
        /// </param>
        /// <param name="innerException">
        /// The exception that is the cause of the current exception,
        /// or a <c>null</c> reference if no inner exception is specified.
        /// </param>
        public HgProcessException(string message, Exception innerException)
            : base(message, innerException)
        {
        }

        /// <summary>
        /// Initializes a new instance of the HgProcessException class
        /// with serialized data.
        /// </summary>
        /// <param name="info">
        /// The <see cref="SerializationInfo"/> that holds the serialized
        /// object data about the exception being thrown.
        /// </param>
        /// <param name="context">
        /// The <see cref="StreamingContext"/> that contains contextual
        /// information about the source or destination.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The info parameter is <c>null</c>.
        /// </exception>
        /// <exception cref="SerializationException">
        /// The class name is <c>null</c> or <see cref="System.Exception.HResult"/>
        /// is zero (0).
        /// </exception>
        protected HgProcessException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }
    }
}
